<?php 
namespace Home\Controller;
class NewsController extends CommonController{
	
	function _initialize() {
		parent::_initialize();
		
	}
	
	public function index(){
		$this->display();
	}
	
	public function getnews(){
		$page = I('page',1);
		$cats_ids = D('Cats')->where(array('group_id'=>6))->getField('id',true);
		$map['cid'] = array('in',$cats_ids);
		$map['status'] = 1;
		$info = D('Contents')->where($map)->order('id desc')->page($page,10)->relation(true)->select();
		count($info) < 10 ? $next = 'no':$next = 'yes';
		$data = array(
				'next'=>$next,
				'info'=>$info,
		);
		// 		$info['content'] = str_to_html($info['content']);
		$this->ajaxReturn($data);
	}
	
	
	public function detail(){
		$id = I('id');
		$this->info = D('Contents')->where(array('id'=>$id))->relation(true)->find();
		$this->display();
	}
}
?>